package com.pcjavanet.domain;

import com.pcjavanet.util.CommonUtil;

public class CChart extends BaseChart {
	private double cBar ;
	private double ucl ; 
	private double lcl ; 
	
	public double getUcl() {
		this.ucl = this.cBar +  3 * Math.sqrt( cBar );
		return ucl ; 
	}

	public void setUcl(double ucl) {
		this.ucl = ucl;
	}

	public double getLcl() {
		this.lcl = this.cBar -  3 * Math.sqrt( cBar );
		return lcl;
	}

	public void setLcl(double lcl) {
		this.lcl = lcl;
	}

	public double getcBar() {
		return cBar;
	}

	public void setcBar(double cBar) {
		this.cBar = cBar;
	}
	
	public void calculateCBar (int totalDefects , int totalSubGroups ) {
		if ( totalSubGroups !=0 )
			cBar = CommonUtil.getPrecision( ((double) totalDefects )/ totalSubGroups ) ; 
	}
}
